




//
//IUT de Nice / Departement informatique / Module APO-C++
//Annee 2008_2009 - Package _Banque
//
//Classe CompteEpargne - Tests unitaires de la methode cloturer
//                     (Cas nominaux)
//
//Auteur : T.Tran Van Thoan - Q.Salmeron
//

public class T_CompteEpargne_N4_2 {
	
	public static void main (String args[]) throws IPException, BUException, Throwable {
		
		Tests.Begin("_Banque.CompteEpargne", "1.5.0");
		
		Banque b = new Banque();
		
		String adresse_1= "Villa Beau Sejour, 115 Av. de la Grande Armee - PARIS (75000)";
		Titulaire durand = new Titulaire("Durand", "Paul", "1981/01/03",  adresse_1);
		
			Tests.Design("Controle du service cloturer", 3); {
				
				Tests.Case("Cas d'une cloture inferieure a 200 euros"); {
					
					CompteEpargne cpt = new CompteEpargne(b, durand, 0.03f);
					
					cpt.executer('V', "Guichet 322455", 200);  
		            cpt.executer('V', "Guichet 322455", 320.5f);  
		            cpt.executer('R',   "Facture 2009-29", 400);

		            Tests.Unit(3,       cpt.getNombreOperations());
		            Tests.Unit(120.5f,  cpt.getSoldeCompte());

		            Tests.Unit(119.543648f,  cpt.cloturer());
		            Tests.Unit(0.f,          cpt.getSoldeCompte());
		            Tests.Unit(4,            cpt.getNombreOperations());
		         }
				
				Tests.Case("Cas d'une cloture superieure a 200 euros"); {      
			         CompteEpargne cpt = new CompteEpargne(b, durand, 0.03f);

			            cpt.executer('V', "Guichet 322455", 300);  
			            cpt.executer('V', "Guichet 322455", 320.5f);  
			            cpt.executer('R',   "Facture 2009-29", 400);

			            Tests.Unit(3,       cpt.getNombreOperations());
			            Tests.Unit(220.5f,  cpt.getSoldeCompte());

			            Tests.Unit(220.5f,  cpt.cloturer());
			            Tests.Unit(0.f,     cpt.getSoldeCompte());
			            Tests.Unit(4,       cpt.getNombreOperations());
			         }
				
			}
			Tests.End();
	}

}
